package com.wn.service.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2022 -08-31
 * @desc
 *
 * direct发送消息
 */
@Component
public class WorkProduct4 {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMsg(String exchangeName,String routing,String msg){

        /**
         * 交换机   对消息进分发到不同的队列中
         * 路由    （通过路由发送到不同的队列中）
         * 消息
         */
        rabbitTemplate.convertAndSend(
                exchangeName,
                routing,
                msg
        );
    }

}
